Loading libraries

library(dplyr)
library(ggplot2)
library(plotly)
library(tidyr)

Reading data

data <- read.csv2('./all_summary.csv', nrows = 10000)
dim(data)
## [1] 10000   412

Processing missing data

required_columns <- c("res_name", "blob_volume_coverage", "blob_volume_coverage_second", "skeleton_density", "local_res_atom_non_h_count", "local_res_atom_non_h_electron_sum")
dim(data)
## [1] 10000   412
data <- data %>% 
  select(one_of(required_columns)) %>%
  drop_na()
dim(data)
## [1] 9836    6

Deleting chosen ligands

deletable_res_name <- c("UNK", "UNX", "UNL", "DUM", "N", "BLOB", "ALA", "ARG", "ASN", "ASP", "CYS", "GLN", "GLU", "GLY", "HIS", "ILE", "LEU", "LYS", "MET", "MSE", "PHE", "PRO", "SEC", "SER", "THR", "TRP", "TYR", "VAL", "DA", "DG", "DT", "DC", "DU", "A", "G", "T", "C", "U", "HOH", "H20", "WAT")
data <- data %>% filter(!res_name %in% deletable_res_name)
dim(data)
## [1] 9776    6

Data summary

statistics <- data %>%
  select(res_name, blob_volume_coverage, blob_volume_coverage_second, skeleton_density)
knitr::kable(summary(statistics))
res_name blob_volume_coverage blob_volume_coverage_second skeleton_density
SO4 :1007 1 : 136 0 :8261 0 :1097
GOL : 632 0.8571428571: 6 0.0243902439 : 2 1 : 959
EDO : 516 0.8333333333: 5 0.02523659306: 2 0.6666666667: 520
NAG : 464 0.8461538462: 5 0.0200661832 : 1 0.5 : 287
CL : 387 0.3266490765: 4 0.02009536785: 1 0.1666666667: 228
DMS : 340 0.75 : 4 0.02016883762: 1 0.1538461538: 224
(Other):6430 (Other) :9616 (Other) :1508 (Other) :6461
dim(data)
## [1] 9776    6

Cardinality of ligands by name

plot_ligands <- ggplot(popular_ligands, aes(x = reorder(res_name, -n), y = n, fill = n)) +
  geom_bar(stat = "identity") +
  theme(axis.text.x = element_text(angle = 90)) +
  xlab("ligand")+
  labs(title = "Cardinality of ligands by name")

ggplotly(plot_ligands)

Distribution of atom and electron count

plot_atom <- ggplot(data, aes(x = local_res_atom_non_h_count)) + 
  geom_density(alpha = .3, fill = "#00CECB", color = NA) +
  xlab("atom count") +
  labs(title = "Atom count distribution")

ggplotly(plot_atom)
plot_electron <- ggplot(data, aes(x = local_res_atom_non_h_electron_sum)) + 
  geom_density(alpha = .3, fill = "#FF5E5B", color = NA) +
  xlab("electron count") +
  labs(title = "Electron count distribution")

ggplotly(plot_electron)